﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aulac.Srv.Db.Connect;
using System.Xml;
using Aulac.Global.Xml;
using Aulac.Rsc.Ems.Tags;

namespace Aulac.Srv.Db.Data.Ems.Stores.RptSotes
{
    public partial class RptStoreMng : Aulac.Srv.Db.Data.Ems.Document.DbEmsDataDocumentMangager
	{
        public RptStoreMng(IDbAulacConnect p_Db)
            : base(p_Db)
        {
        }

        /// <summary>
        /// Bang Ke Phieu Nhap Kho
        /// </summary>
        public XmlDataDocument GetRptListRecStoreVch(XmlDataDocument xmlParam)
        {
            /* Author Write: H.Rin */
            /* Code Update: 01/18/2011 */

            string sVchDateFrom = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateFrom);
            string sVchDateTo = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateTo);
            string sStorePrkID = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.StorePrkID);
            XmlDataDocument xmlOut = GetDbListRecStoreVch(sStorePrkID, sVchDateFrom, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateFrom, sVchDateFrom);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateTo, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagItems.Store.StoreName, XmlProcess.GetValueVchHeader(GetStoreName(sStorePrkID), tagItems.Store.StoreName));
            return xmlOut;
        }

        /// <summary>
        /// Bang Ke Phieu Xuat Kho
        /// </summary>
        public XmlDataDocument GetRptListRelsStoreVch(XmlDataDocument xmlParam)
        {
            /* Author Write: H.Rin */
            /* Code Update: 01/18/2011 */

            string sVchDateFrom = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateFrom);
            string sVchDateTo = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateTo);
            string sStorePrkID = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.StorePrkID);
            XmlDataDocument xmlOut = GetDbListRelsStoreVch(sStorePrkID, sVchDateFrom, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateFrom, sVchDateFrom);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateTo, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagItems.Store.StoreName, XmlProcess.GetValueVchHeader(GetStoreName(sStorePrkID), tagItems.Store.StoreName));
            return xmlOut;
        }

        /// <summary>
        /// Get Data Chi tiet Phieu Nhap Kho
        /// </summary>
        public XmlDataDocument GetRptListDetailRecStoreVch(XmlDataDocument xmlParam)
        {
            /* Author Write: H.Rin */
            /* Code Update: 01/18/2011 */

            string sVchDateFrom = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateFrom);
            string sVchDateTo = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateTo);
            string sStorePrkID = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.StorePrkID);
            XmlDataDocument xmlOut = GetDetailDbListRecStoreVch(sStorePrkID, sVchDateFrom, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateFrom, sVchDateFrom);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateTo, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagItems.Store.StoreName, XmlProcess.GetValueVchHeader(GetStoreName(sStorePrkID), tagItems.Store.StoreName));
            return xmlOut;
        }


        /// <summary>
        /// Get Data Chi tiet Phieu Xuat Kho.
        /// </summary>
        public XmlDataDocument GetRptListDetailRelsStoreVch(XmlDataDocument xmlParam)
        {
            /* Author Write: H.Rin */
            /* Code Update: 01/18/2011 */

            string sVchDateFrom = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateFrom);
            string sVchDateTo = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.VchDateTo);
            string sStorePrkID = XmlProcess.GetValueParam(xmlParam, tagVch.Inv.StorePrkID);
            XmlDataDocument xmlOut = GetDetailDbListRelsStoreVch(sStorePrkID, sVchDateFrom, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateFrom, sVchDateFrom);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagVch.Inv.VchDateTo, sVchDateTo);
            XmlProcess.SetAtrbVchHeader(xmlOut, tagItems.Store.StoreName, XmlProcess.GetValueVchHeader(GetStoreName(sStorePrkID), tagItems.Store.StoreName));
            return xmlOut;
        }        
    }
}
